<template>
	<view>
		<view class="content themeBac cwhite">
			<view class="f20">提现金额</view>

			<view class="f-c inputBpx">
				<u-icon name="rmb"></u-icon>
				<input @input="moneyInput" type='number' placeholder="请输入提现金额" />
			</view>

			<view class="f-c-b f30">
				<text>提现方式</text>
				<view @click="$to('../wallet-withdraw-authorization/wallet-withdraw-authorization')">
					<text>{{payType}}</text>
					<u-icon name="arrow-right"></u-icon>
				</view>
			</view>
		</view>

		<view class="btn">
			<button @click="toWithdraw" class="themeBac cwhite">确认提现</button>
		</view>

		<!-- 支付弹框 -->
		<!-- <u-popup border-radius="10" width=70% height="350rpx" v-model="show" mode="center" closeable>
			<view class="u-popup f-co-c">
				<view class="u-popup-title f25">请输入支付密码</view>
				<view class="u-popup-price themeColor">￥ {{money}}</view>
				<view class="u-popup-pass">
					<view class="u-popup-pass-type f-c-b f25">
						<text>支付方式</text>
						<text>{{payType}}</text>
					</view>
					<u-message-input @finish="finish" @change="change" mode="box" :maxlength="maxlength" :value="code"
						:focus="true" :dot-fill="true" width=55 active-color="#BCBCBC" :breathe="false">
					</u-message-input>
				</view>
			</view>
		</u-popup> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				money: '',
				code: '',
				maxlength: 6,
				payType: '微信'
			}
		},

		mounted() {
			// $on 监听事件
			uni.$on('type', data => {
				console.log(data)
				//  这里可以修改数据
				this.payType=data
			})
		},

		methods: {
			async toWithdraw() {
				if (this.$u.test.digits(this.money)) {
					const res = await this.$u.api.goWithdrawal({
						id: this.vuex_user.id,
						money: this.money,
						way:this.payType=="微信"?1:2
					})
					console.log(res);
					res.success ? this.$to('../wallet-withdraw-success/wallet-withdraw-success') : this.$u.toast(res.msg)
				} else {
					this.$u.toast('请输入正确的金额！')
				}



			},
			moneyInput(v) {
				this.money = v.detail.value
				console.log(this.money);
			},
			// change(e) {
			// 	console.log('内容改变，当前值为：' + e);
			// },
			// finish(e) {
			// 	console.log('输入结束，当前值为：' + e);
			// 	this.show=false
			// 	this.$to('../wallet-withdraw-success/wallet-withdraw-success')
			// },
		}
	}
</script>

<style>
	.content {
		padding: 30rpx;
		margin: 20rpx 30rpx;
		border-radius: 10rpx;
		opacity: 0.84;
	}

	.inputBpx {
		margin: 80rpx 0 30rpx 0;
		border-bottom: 1rpx solid #FFFFFF;
		padding-bottom: 10rpx;
	}

	.inputBpx .u-icon {
		margin-right: 20rpx;
		font-size: 44rpx;
	}

	.input-placeholder {
		font-size: 44rpx;
		color: #9B9B9B;
	}

	.btn {
		margin: 60rpx 70rpx;
	}

	.u-popup {
		padding: 20rpx;
	}

	.u-popup-title {
		color: #6D6D6D;
	}

	.u-popup-price {
		font-weight: 700;
		font-size: 48rpx;
		margin: 30rpx 0;
	}

	.u-char-box {
		width: 100%;
	}

	.u-popup-pass {
		color: #6D6D6D;
		border-top: 1rpx solid #CCCCCC;
		padding-top: 20rpx;
	}

	.u-popup-pass-type {
		margin-bottom: 20rpx;
	}
</style>
